/**
 * Created with IntelliJ IDEA.
 * User: Thoughtworker
 * Date: 7/11/13
 * Time: 2:50 PM
 * To change this template use File | Settings | File Templates.
 */
public class MembershipCommand implements Command {

    Library library;
    Menu menu;
    UserDataBase userDataBase;
    public MembershipCommand(Library library, Menu menu, UserDataBase usersDatabase) {
        this.library = library;
        this.menu = menu;
        this.userDataBase = usersDatabase;
    }

    @Override
    public void select() {
        if(userDataBase.isSomeoneLoggedIn()) userDataBase.printLoggedInUser();
        else{
            if(userDataBase.checkUserCredentials()) {
                userDataBase.printLoggedInUser();
            }
            else {
                menu.printSeeLibrarian();
            }
        }
    }

}
